package org.bee.rpc;

import org.bee.ResultTool;
import org.bee.apis.AdminApis;
import org.bee.mappers.AdminUserMapper;
import org.bee.model.AdminUser;
import org.bee.model.result.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class AdminApisController implements AdminApis {

    private final AdminUserMapper adminUserMapper;

    public AdminApisController(AdminUserMapper adminUserMapper) {
        this.adminUserMapper = adminUserMapper;
    }

    @Override
    @GetMapping("/testRpc")
    public Result testRpc() {
        Result result = ResultTool.success();
        List<AdminUser> adminUsers = adminUserMapper.selectByExample(null);
        result.setData(adminUsers);
        return result;
    }
}
